﻿Imports AccesoDatos

Public Class CatalogoEmpleado

    Public Function ListaEmpleados(ByVal pstrDNI As String, ByVal pstrApePat As String, ByVal pstrApeMAt As String, ByVal pstrNombre As String, _
                                   ByVal pstrLocal As String, ByVal pstrEstado As String, ByVal pstrInicio As String, ByVal pstrFin As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                       {"@APEPAT", SqlDbType.VarChar, UCase(pstrApePat)}, _
                                       {"@APEMAT", SqlDbType.VarChar, UCase(pstrApeMAt)}, _
                                       {"@NOMBRE", SqlDbType.VarChar, UCase(pstrNombre)}, _
                                       {"@LOCAL", SqlDbType.VarChar, UCase(pstrLocal)}, _
                                       {"@ESTADO", SqlDbType.VarChar, UCase(pstrEstado)}, _
                                       {"@INICIO", SqlDbType.VarChar, UCase(pstrInicio)}, _
                                       {"@FIN", SqlDbType.VarChar, UCase(pstrFin)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_BANDEJA_EMPLEADOS", Parametros)
        Return dsConsultaDatos
    End Function

    Public Function ListaEmpleado(ByVal pstrCodigo As String, ByVal pstrContrato As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@CODIGO", SqlDbType.VarChar, UCase(pstrCodigo)}, _
                                       {"@CONTRATO", SqlDbType.VarChar, UCase(pstrContrato)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_DETALLE_EMPLEADO", Parametros)
        Return dsConsultaDatos
    End Function

    Public Function InsertaEmpleado(ByVal pstrDNI As String, ByVal pstrAPaterno As String, ByVal pstrAMaterno As String, ByVal pstrNombres As String, _
                                    ByVal pstrSexo As String, ByVal pstrFNac As String, ByVal pstrTelef As String, ByVal pstrCel As String, _
                                    ByVal pstrDirecc As String, ByVal pstrDistrito As String, ByVal pstrInstruccion As String, ByVal pstrECivil As String, _
                                    ByVal pstrCorreo As String, ByVal pstrAFP As String, ByVal pstrNroAFP As String, ByVal pstrNroEssalud As String, _
                                    ByVal pstrRUC As String, ByVal pstrFoto As String, ByVal pstrUsuario As String) As Integer
        Dim Resultado As Integer
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                       {"@PATERNO", SqlDbType.VarChar, UCase(pstrAPaterno)}, _
                                       {"@MATERNO", SqlDbType.VarChar, UCase(pstrAMaterno)}, _
                                       {"@NOMBRE", SqlDbType.VarChar, UCase(pstrNombres)}, _
                                       {"@SEXO", SqlDbType.VarChar, UCase(pstrSexo)}, _
                                       {"@FNAC", SqlDbType.VarChar, UCase(pstrFNac)}, _
                                       {"@TELEF", SqlDbType.VarChar, UCase(pstrTelef)}, _
                                       {"@CEL", SqlDbType.VarChar, UCase(pstrCel)}, _
                                       {"@DIRECC", SqlDbType.VarChar, UCase(pstrDirecc)}, _
                                       {"@DISTRITO", SqlDbType.VarChar, UCase(pstrDistrito)}, _
                                       {"@INSTRUCCION", SqlDbType.VarChar, UCase(pstrInstruccion)}, _
                                       {"@ECIVIL", SqlDbType.VarChar, UCase(pstrECivil)}, _
                                       {"@CORREO", SqlDbType.VarChar, LCase(pstrCorreo)}, _
                                       {"@AFP", SqlDbType.VarChar, UCase(pstrAFP)}, _
                                       {"@NROAFP", SqlDbType.VarChar, UCase(pstrNroAFP)}, _
                                       {"@ESSALUD", SqlDbType.VarChar, UCase(pstrNroEssalud)}, _
                                       {"@RUC", SqlDbType.VarChar, UCase(pstrRUC)}, _
                                       {"@FOTO", SqlDbType.VarChar, UCase(pstrFoto)}, _
                                       {"@USUARIO", SqlDbType.VarChar, UCase(pstrUsuario)}}
        Resultado = objCom.ExecSPIntegerCP("SP_INSERTA_EMPLEADO", Parametros)
        Return Resultado

    End Function

    Public Function ListaContratos(ByVal pstrDNI As String, ByVal pstrApePat As String, ByVal pstrApeMAt As String, ByVal pstrNombre As String, _
                                  ByVal pstrEstado As String, ByVal pstrLocal As String, ByVal pstrInicio As String, ByVal pstrFin As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                       {"@APEPAT", SqlDbType.VarChar, UCase(pstrApePat)}, _
                                       {"@APEMAT", SqlDbType.VarChar, UCase(pstrApeMAt)}, _
                                       {"@NOMBRE", SqlDbType.VarChar, UCase(pstrNombre)}, _
                                       {"@ESTADO", SqlDbType.VarChar, UCase(pstrEstado)}, _
                                       {"@LOCAL", SqlDbType.VarChar, UCase(pstrLocal)}, _
                                       {"@FECHA1", SqlDbType.VarChar, UCase(pstrInicio)}, _
                                       {"@FECHA2", SqlDbType.VarChar, UCase(pstrFin)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_BANDEJA_CONTRATOS", Parametros)
        Return dsConsultaDatos
    End Function

    Public Function InsertaContrato(ByVal pstrCorrelativo As String, ByVal pstrDNI As String, _
                                    ByVal pstrInicio As String, ByVal pstrFin As String, ByVal pstrLocal As String, ByVal pstrCargo As String, _
                                    ByVal pstrSalario As String, ByVal pstrObservaciones As String, ByVal pstrUsuario As String) As Integer
        Dim Resultado As Integer
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@NRO", SqlDbType.VarChar, UCase(pstrCorrelativo)}, _
                                        {"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                        {"@INICIO", SqlDbType.VarChar, UCase(pstrInicio)}, _
                                        {"@FIN", SqlDbType.VarChar, UCase(pstrFin)}, _
                                       {"@LOCAL", SqlDbType.VarChar, UCase(pstrLocal)}, _
                                       {"@CARGO", SqlDbType.VarChar, UCase(pstrCargo)}, _
                                       {"@SALARIO", SqlDbType.VarChar, UCase(pstrSalario)}, _
                                       {"@OBS", SqlDbType.VarChar, UCase(pstrObservaciones)}, _
                                       {"@USUARIO", SqlDbType.VarChar, UCase(pstrUsuario)}}
        Resultado = objCom.ExecSPIntegerCP("SP_INSERTA_CONTRATO", Parametros)
        Return Resultado

    End Function

    Public Function ActualizaContrato(ByVal pstrCorrelativo As String, ByVal pstrDNI As String, _
                                   ByVal pstrInicio As String, ByVal pstrFin As String, ByVal pstrLocal As String, ByVal pstrCargo As String, _
                                   ByVal pstrSalario As String, ByVal pstrObservaciones As String, ByVal pstrUsuario As String) As Integer
        Dim Resultado As Integer
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@NRO", SqlDbType.VarChar, UCase(pstrCorrelativo)}, _
                                        {"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                        {"@INICIO", SqlDbType.VarChar, UCase(pstrInicio)}, _
                                        {"@FIN", SqlDbType.VarChar, UCase(pstrFin)}, _
                                       {"@LOCAL", SqlDbType.VarChar, UCase(pstrLocal)}, _
                                       {"@CARGO", SqlDbType.VarChar, UCase(pstrCargo)}, _
                                       {"@SALARIO", SqlDbType.VarChar, UCase(pstrSalario)}, _
                                       {"@OBS", SqlDbType.VarChar, UCase(pstrObservaciones)}, _
                                       {"@USUARIO", SqlDbType.VarChar, UCase(pstrUsuario)}}
        Resultado = objCom.ExecSPIntegerCP("SP_ACTUALIZA_CONTRATO", Parametros)
        Return Resultado

    End Function

    Public Function ListaPrestamos(ByVal pstrDNI As String, ByVal pstrApePat As String, ByVal pstrApeMAt As String, ByVal pstrNombre As String, _
                                   ByVal pstrInicio As String, ByVal pstrFin As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                       {"@APEPAT", SqlDbType.VarChar, UCase(pstrApePat)}, _
                                       {"@APEMAT", SqlDbType.VarChar, UCase(pstrApeMAt)}, _
                                       {"@NOMBRE", SqlDbType.VarChar, UCase(pstrNombre)}, _
                                       {"@INICIO", SqlDbType.VarChar, UCase(pstrInicio)}, _
                                       {"@FIN", SqlDbType.VarChar, UCase(pstrFin)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_BANDEJA_PRESTAMOS", Parametros)
        Return dsConsultaDatos
    End Function

    Public Function ListaPrestamoDetalle(ByVal pstrID As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@ID", SqlDbType.VarChar, UCase(pstrID)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_DETALLE_PRESTAMO", Parametros)
        Return dsConsultaDatos
    End Function

    Public Function CalculaPrestamo(ByVal pstrFecha As String, ByVal pstrMonto As String, ByVal pstrCuotas As String, _
                                    ByVal pstrValor As String, ByVal pstrFrecuencia As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@Fecha", SqlDbType.VarChar, UCase(pstrFecha)}, _
                                       {"@Monto", SqlDbType.VarChar, UCase(pstrMonto)}, _
                                       {"@Cuotas", SqlDbType.VarChar, UCase(pstrCuotas)}, _
                                       {"@Valor", SqlDbType.VarChar, UCase(pstrValor)}, _
                                       {"@Frecuencia", SqlDbType.VarChar, UCase(pstrFrecuencia)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_CALCULA_PRESTAMO", Parametros)
        Return dsConsultaDatos
    End Function

    Public Function InsertaPrestamo(ByVal pstrID As String, ByVal pstrCOD As String, ByVal pstrDNI As String, ByVal pstrFecha As String, _
                                    ByVal pstrMonto As String, ByVal pstrFREC As String, ByVal pstrINICIO As String, _
                                    ByVal pstrCuotas As String, ByVal pstrPAGO As String, ByVal pstrUSUARIO As String) As Integer
        Dim Resultado As Integer
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@ID", SqlDbType.VarChar, UCase(pstrID)}, _
                                       {"@COD", SqlDbType.VarChar, UCase(pstrCOD)}, _
                                       {"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                       {"@FECHA", SqlDbType.VarChar, UCase(pstrFecha)}, _
                                       {"@MONTO", SqlDbType.VarChar, UCase(pstrMonto)}, _
                                       {"@FREC", SqlDbType.VarChar, UCase(pstrFREC)}, _
                                       {"@INICIO", SqlDbType.VarChar, UCase(pstrINICIO)}, _
                                       {"@CUOTAS", SqlDbType.VarChar, UCase(pstrCuotas)}, _
                                       {"@PAGO", SqlDbType.VarChar, UCase(pstrPAGO)}, _
                                       {"@USUARIO", SqlDbType.VarChar, UCase(pstrUSUARIO)}}
        Resultado = objCom.ExecSPIntegerCP("SP_INSERTA_PRESTAMO", Parametros)
        Return Resultado
    End Function


    '****************************
    '     REPORTES
    '***************************
    Public Function PlanillaEmpleados(ByVal pstrDNI As String, ByVal pstrApePat As String, ByVal pstrApeMAt As String, ByVal pstrNombre As String, _
                                   ByVal pstrLocal As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                       {"@APEPAT", SqlDbType.VarChar, UCase(pstrApePat)}, _
                                       {"@APEMAT", SqlDbType.VarChar, UCase(pstrApeMAt)}, _
                                       {"@NOMBRE", SqlDbType.VarChar, UCase(pstrNombre)}, _
                                       {"@LOCAL", SqlDbType.VarChar, UCase(pstrLocal)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_BANDEJA_PLANILLASEMANAL", Parametros)
        Return dsConsultaDatos
    End Function

    Public Function PlanillaLocal(ByVal pstrDNI As String, ByVal pstrApePat As String, ByVal pstrApeMAt As String, ByVal pstrNombre As String, _
                                   ByVal pstrLocal As String) As DataSet
        Dim dsConsultaDatos As DataSet
        Dim objCom As New BaseDatos
        Dim Parametros(,) As Object = {{"@DNI", SqlDbType.VarChar, UCase(pstrDNI)}, _
                                       {"@APEPAT", SqlDbType.VarChar, UCase(pstrApePat)}, _
                                       {"@APEMAT", SqlDbType.VarChar, UCase(pstrApeMAt)}, _
                                       {"@NOMBRE", SqlDbType.VarChar, UCase(pstrNombre)}, _
                                       {"@LOCAL", SqlDbType.VarChar, UCase(pstrLocal)}}
        dsConsultaDatos = objCom.ExecSPDataSetCP("SP_BANDEJA_PLANILLA_LOCAL", Parametros)
        Return dsConsultaDatos
    End Function


End Class
